/**
* @Title: warning_ctrl.js
* @Description: TODO
* Copyright: Copyright (c) 2014 
 * Company:中国平安
*
* @Project HIMS-FWA
* @date 2014年10月27日 下午4:43:38
* @version V1.0
*/
;
(function(){
	'use strict';
	
	var app = angular.module('fwa.mainApp');
	app.controller('CaseAuditMedicalDetailCtrl', ['$scope','$modal','BaseURL','Modal',
	                                              '$modalInstance','FwaTabsetService','$state','InstitutionListService',
	                                function($scope,$modal,baseUrl,Modal
	                                		,$modalInstance,fwaTabsetService,$state,institutionListService){
       
		
		//关闭弹窗
         $scope.onOk = function() {
             $modalInstance.dismiss();
         }
         
         $scope.medicalData = {};
         $scope.orgData = {};
         
         function queryMedicalDetail(orgCode,orgType){
	        institutionListService.query({providerCode:orgCode,providertype:orgType,page:"1",pageSize:"20"}).success(function(res){
	        	if(res){
	        		if(res.result.length !=0){
	        			$scope.orgData = res.result[0];
	        		} 
	        	}
			});
		}
 		
 		if(!angular.isUndefined($scope.tempData) && $scope.tempData && $scope.tempData.length !=0){
			for(var i=0;i<$scope.tempData.length;i++){
				if($scope.tempData[i].isDeleted == 0){
					$scope.medicalData = $scope.tempData[i];
					queryMedicalDetail($scope.medicalData.medicalCode,$scope.medicalData.orgType);
					break;
				}
			}
 		}
 		
	}]);
})();